<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>通过prop向子组件传递数据</title>
</head>
<body>
<div id="app">
    <div>{{pmsg}}</div>
    <menu-item :menu-title="ptitle" content="hello"></menu-item>
</div>

<!-- 开发环境版本，包含了有帮助的命令行警告 -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script type="text/javascript">
    /**
     * 父组件向子组件传值-属性命规则
     */
    Vue.component("third-com", {
        props: ["testTitle"],
        template: "<div>{{testTitle}}</div>"
    });

    Vue.component("menu-item", {
        props: ["menuTitle", "content"],
        template: "<div>{{menuTitle}} <third-com testTitle='hello'></third-com></div>"
    });

    var vue = new Vue({
        el: "#app",
        data: {
            pmsg: "父组件中内容",
            ptitle: "动态绑定属性"
        }
    })
</script>
</body>
</html>
